package cn.gyouzhe.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 商品信息
 *
 * @author wangchuan
 * @datetime 2018/2/12 21:50
 */
@Getter
@Setter
@NoArgsConstructor
@ToString
public class Good {
    private int id;
    /**
     * 商品ID
     */
    private String goodId;
    /**
     * 商品标题
     */
    private String title;
    /**
     * 短标题
     */
    private String shortTitle;
    /**
     * 商品描述
     */
    private String desc;
    /**
     * 商品图片
     */
    private String pic;
    /**
     * 商品原始价格
     */
    private BigDecimal price = BigDecimal.ZERO;
    /**
     * 商品返佣比例
     */
    private BigDecimal commission = BigDecimal.ZERO;
    /**
     * 分类ID
     */
    private int cid;
    /**
     * 是否是天猫商品
     */
    private int tmall = 0;

    /**
     * 销量
     */
    private int sellNum = 0;
    /**
     * 卖家ID
     */
    private String sellerId;
    /**
     * 券ID
     */
    private String couponId;
    /**
     * 是否删除 0表示未删除 1、表示删除
     */
    private int del = 0;
    /**
     * 创建时间
     */
    private LocalDateTime createTime = LocalDateTime.now();
    /**
     * 更新时间
     */
    private LocalDateTime updateTime = LocalDateTime.now();


    private Good(
            String goodId,
            String title,
            String shortTitle,
            String desc,
            String pic,
            BigDecimal price,
            BigDecimal commission,
            int cid,
            int tmall,
            int sellNum,
            String sellerId,
            String couponId) {
        this.goodId = goodId;
        this.title = title;
        this.shortTitle = shortTitle;
        this.desc = desc;
        this.pic = pic;
        this.price = price;
        this.commission = commission;
        this.cid = cid;
        this.tmall = tmall;
        this.sellNum = sellNum;
        this.sellerId = sellerId;
        this.couponId = couponId;
    }

    public Good(
            int id,
            String goodId,
            String title,
            String shortTitle,
            String desc,
            String pic,
            BigDecimal price,
            BigDecimal commission,
            int cid,
            int tmall,
            int sellNum,
            String sellerId,
            String couponId,
            int del) {
        this.id = id;
        this.goodId = goodId;
        this.title = title;
        this.shortTitle = shortTitle;
        this.desc = desc;
        this.pic = pic;
        this.price = price;
        this.commission = commission;
        this.cid = cid;
        this.tmall = tmall;
        this.sellNum = sellNum;
        this.sellerId = sellerId;
        this.couponId = couponId;
        this.del = del;
    }

    public static Good of(String goodId, String title, String shortTitle, String desc, String pic, BigDecimal price, BigDecimal commission, int cid, int tmall, int sellNum, String sellerId, String couponId) {
        return new Good(goodId, title, shortTitle, desc, pic, price, commission, cid, tmall, sellNum, sellerId, couponId);
    }

    public static Good of(
            int id,
            String goodId,
            String title,
            String shortTitle,
            String desc,
            String pic,
            BigDecimal price,
            BigDecimal commission,
            int cid,
            int tmall,
            int sellNum,
            String sellerId,
            String couponId,
            int del) {
        return new Good(id, goodId, title, shortTitle, desc, pic, price, commission, cid, tmall, sellNum, sellerId, couponId, del);
    }
}
